#!/bin/bash

# $Header: /opt/unixmon/tools/DNS/RCS/named_status,v 1.1 2012/11/27 07:50:51 yajin Exp $
# Author: yang.jin@ebay.com


export PATH=/bin:/usr/bin

DNS_SERVERS_LIST="/etc/named/IT_DNS_SERVERS"
RNDC="/opt/bind/sbin/rndc"

if [ ! -f $DNS_SERVERS_LIST ]; then
        echo -e "The configuration file \"$DNS_SERVERS_LIST\" does not exist." >&2
        exit 2
fi

. $DNS_SERVERS_LIST

paras=""


while [ $1 ]; do
	paras=$(echo -e "$paras $1")
	shift
done

for host in $DNS_PRIMARY_MASTER $DNS_PSEUDO_MASTERS $DNS_SLAVES; do
	echo -e "\n============ $host ============" 
	ssh $host "$RNDC status"
done

